<!doctype html>
<html>
<head>
<script src="../../../resources/js-test.js"></script>
</head>
<body>
  <div></div>
<script>
var div = document.querySelector("div");
document.body.appendChild(div);
var shadowRoot = div.attachShadow({mode: 'open'});

//Window named properties
var namedElements = ['a', 'area', 'embed', 'form', 'frame',
    'frameset', 'iframe','img', 'object'];

var element;
namedElements.forEach(function (tagName) {
    element = document.createElement(tagName);
    element.name = 'named_' + tagName;

    debug("&lt;" + tagName + "&gt;: Before appendChild, " + element.name + " should not be in document.");
    shouldBeFalse("element.name in document");
    shouldBeFalse("element.name in window");
    shadowRoot.appendChild(element);
    debug("&lt;" + tagName + "&gt;: After appendChild, " + element.name + " should not still be in document, because the element was inserted into a shadow DOM tree.");
    shouldBeFalse("element.name in document");
    shouldBeFalse("element.name in window");

    element.setAttribute('name', 'renamed_' + tagName);
    debug("&lt;" + tagName + "&gt;: After changing its name attribute into " + element.name + " by using setAttribute, the name should not still be in document.");
    shouldBeFalse("element.name in document");
    shouldBeFalse("element.name in window");
    element.name = 're-renamed_' + tagName;
    debug("&lt;" + tagName + "&gt;: After changing its name attribute into " + element.name + " by using '.name=', the name should not still be in document.");
    shouldBeFalse("element.name in document");
    shouldBeFalse("element.name in window");
});
</script>
</body>
</html>
